Fix Blazor Identity scaffolding to target client project for WASM/Auto Global apps#3765
Open
haileymck wants to merge 1 commit into
Open
Fix Blazor Identity scaffolding to target client project for WASM/Auto Global apps#3765haileymck wants to merge 1 commit into
haileymck wants to merge 1 commit into
Conversation
…o Global apps In Blazor WASM/Auto Global interactivity projects, all interactive pages and layout components live in the .Client project, not the server project. The Identity scaffolder was always generating Account pages into the server project, so they were never reachable and no register/login UI appeared. Fix: detect WASM/Auto Global projects by checking for the absence of Components/Layout/MainLayout.razor in the server project directory (same heuristic as PR #3764). When detected, redirect the scaffolded Account files to the .Client sibling project and update all namespaces accordingly. Changes: - BlazorIdentityModel: add RootNamespace property for path resolution - BlazorIdentityGenerator (VS path): detect WASM/Auto Global via project references, set BaseOutputPath/BlazorIdentityNamespace/BlazorLayoutNamespace/ RootNamespace to the client project; use RootNamespace in ExecuteTemplates - IdentityModel (CLI): add IdentityProjectName for client project path resolution - ValidateIdentityStep (CLI): detect WASM/Auto Global via sibling .Client folder, set BaseOutputPath/IdentityNamespace/IdentityLayoutNamespace/IdentityProjectName - BlazorIdentityHelper (CLI): use IdentityProjectName in StringUtil.ToPath call - BlazorIdentityScaffolderBuilderExtensions (CLI): use IdentityModel.BaseOutputPath for static file placement instead of always using the server project directory Does not repro on Blazor Server Global or per-page/component projects because MainLayout.razor exists in the server project for those configurations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Blazor WASM/Auto Global interactivity projects, all interactive pages and layout components live in the .Client project, not the server project. The Identity scaffolder was always generating Account pages into the server project, so they were never reachable and no register/login UI appeared.
Fix: detect WASM/Auto Global projects by checking for the absence of Components/Layout/MainLayout.razor in the server project directory (same heuristic as PR #3764). When detected, redirect the scaffolded Account files to the .Client sibling project and update all namespaces accordingly.
Changes:
Does not repro on Blazor Server Global or per-page/component projects because MainLayout.razor exists in the server project for those configurations.
fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2993241